﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;

namespace VLog
{
    /// <summary>
    /// txt 日志
    /// </summary>
    public class TxtVLog : VLogBase
    {
        public TxtVLog()
        {
            this.Path = LogCommons.GetPath(PathType.Txt);
        }

        protected override bool Write(VLogEntity entity)
        {
            string text = string.Format(@"
Senders:    {0}
Content:    {1}
Date:       {2}
Level:      {3}
", base.GetSenders()
                  , entity.FullInfo
                  , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff")
                  , entity.Level
                  );

            File.AppendAllText(this.Path, text, Encoding.UTF8);

            return true;
        }
    }
}
